<link href="{{$core_css}}/form_gen_lib/form.css" rel="stylesheet" type="text/css" />
<h1 class="h1Text">User Details</h1>

<a style="color:#333333" href="{{$base_index_url}}/user/admin/search/">Search</a>»<b>User Detail</b>
<br><br>
<fieldset>
    <legend>User Information</legend>
    <label for="fname">First Name</label>
    <input type="text" size="30" name="fname" value="{{if $user_obj!=NULL}}{{$user_obj->first_name}}{{/if}}" id="inputString" />
    <br />
    <label for="lname">Last Name</label>
    <input type="text" size="30" name="lname" value="{{if $user_obj!=NULL}}{{$user_obj->last_name}}{{/if}}" id="inputString" />
    <br />
    <label for="username">Username</label>
    <input type="text" size="30" name="username" value="{{if $user_obj!=NULL}}{{$user_obj->username}}{{/if}}" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
    <br />
    <label for="email">Email</label>
    <input type="text" size="30" name="email" value="{{if $user_obj!=NULL}}{{$user_obj->email}}{{/if}}" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
    <br />
</fieldset>


<form method="post" action="{{$base_index_url}}/user/admin/add_shipping/" />
        Add more shipping address
        <input type="submit" id="submit" class="button" value="Add" name="add" >
        <input type="hidden" name="user_id" value="{{$user_obj->id}}"  />
</form>

{{if $user_shipping_address_list!=NULL}}
<fieldset>
    <legend>Billing Address</legend>
    <table>
        <tr style="background-color: white">
            <td width="5%"></td>
            <td width="25%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Address 1</td>
            <td width="26%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Country</td>
            <td width="27%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Province</td>
            <td></td>
        </tr>
        <form method="post" action="{{$base_index_url}}/user/admin/address_detail/" />
        <tr>
            <td></td>
            <td>{{if $user_billing_address!=NULL}}{{$user_billing_address->address_1}}{{/if}}</td>
            <td>{{if $user_billing_address!=NULL}}{{$user_billing_address->country}}{{/if}}</td>
            <td>{{if $user_billing_address!=NULL}}{{$user_billing_address->province}}{{/if}}</td>
            <td><input type="submit" id="submit" class="button" value="View/Edit" name="view" ></td>
            <input type="hidden" name="address_id" value="{{if $user_billing_address!=NULL}}{{$user_billing_address->id}}{{/if}}"  />
        </tr>
        </form>

    </table>
{{/if}}
</fieldset>
{{if $user_shipping_address_list!=NULL}}
<fieldset>
    <legend>Shipping Addresses</legend>
<table>
    <tr style="background-color: white">
        <td width="5%"></td>
        <td width="25%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Address 1</td>
        <td width="25%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Country</td>
        <td width="25%" style="font-size: 14px; text-decoration: underline; color:DarkCyan ;">Province</td>
        <td></td>
        <td></td>
    </tr>
        {{assign var="i" value=1}}
{{foreach from=$user_shipping_address_list item=a}}
<form method="post" action="{{$base_index_url}}/user/admin/address_detail/" />
    <tr>
        <td>{{$i}}</td>
        <td>{{if $a!=NULL}}{{$a->address_1}}{{/if}}</td>
        <td>{{if $a!=NULL}}{{$a->country}}{{/if}}</td>
        <td>{{if $a!=NULL}}{{$a->province}}{{/if}}</td>
        <td><input type="submit" id="submit" class="button" value="View/Edit" name="view" ></td>
        <td><img width="20px"
                 src="{{$base_url}}application/modules/core/images/common/delete.png"
                 title="Delete this item" style="cursor:pointer"
                 onclick="if(confirm('Are you sure you want to delete the address in row {{$i}} ?'))
                 document.location = '{{$base_index_url}}/user/admin/address_detail/delete_address/{{$a->id}}/{{$a->user_id}}';">
        </td>
<!--        <td><input type="submit" id="submit" class="button" value="Delete" name="delete" ></td>-->

        <input type="hidden" name="address_id" value="{{if $a!=NULL}}{{$a->id}}{{/if}}"  />
        <input type="hidden" name="id" value="{{if $a!=NULL}}{{$a->user_id}}{{/if}}"  />
    </tr>
    <span style="display:none">{{$i++}}</span>
</form>
{{/foreach}}
</table>
</fieldset>
{{/if}}
<br>
